<template>
  <el-dialog title="预览文章" :visible="showDialog" @close="close">
    <h1>{{ content.title }}</h1>
    <div>
      <span>{{ content.createTime | formatDate }}</span>
      <span>{{ content.username }}</span>
      <i class="el-icon-view"></i>
      <span>{{ content.visits }}</span>
    </div>
    <div v-html="content.articleBody"></div>
  </el-dialog>
</template>

<script>
export default {
  props: {
    showDialog: {
      type: Boolean,
      required: true,
    },
    content: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {};
  },
  methods: {
    close() {
      this.$emit("update:showDialog", false);
    },
  },
};
</script>

<style scoped>
:deep(img){
  width: 100%;
}
</style>
